<?php
declare(strict_types=1);

namespace app\listener;

use think\facade\Config;
use app\logic\api\admin\general\RequestLogLogic;

class RequestLogListener
{
    /**
     * 事件监听处理
     *
     * @return mixed
     */
    public function handle($event)
    {
        $request = request();
        if (($request->isPost() || $request->isPut() || $request->isDelete()) && Config::get('zhtp.auto_write_request_log')) {
            (new RequestLogLogic)->record($request, $event);
        }
    }
}
